package com.boot.stomp.service.impl;

import com.boot.stomp.service.StompConsumerService;
import org.springframework.messaging.Message;
import org.springframework.messaging.simp.SimpMessagingTemplate;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description Stomp 消息消费者
 * @date 2021/8/2 23:02
 **/

public class DefaultStompConsumerServiceImpl<T> implements StompConsumerService<T> {

    private final SimpMessagingTemplate template;

    public DefaultStompConsumerServiceImpl(SimpMessagingTemplate template) {
        this.template = template;
    }

    @Override
    public void accept(Message<T> message) {
        template.send(message);
    }
}
